package com.vercon.moensmart.newtork.interceptor;

import com.vercon.common.Constants;
import com.vercon.common.utils.MirrorDataStorage;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public class TokenInterceptor implements Interceptor {

    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request = chain.request();
        request = request.newBuilder()
                    .header("Authorization", "token "+MirrorDataStorage.instance().getString(Constants.STORAGE_KEY_TOKEN,""))
                    .build();
        return chain.proceed(request);
    }
}